Hi!
I made a game, which is supposed to random a number in specified range and let you guess it 11 times.
It keeps crashing and I can`t find the error in code. I`d be thankful to any help
Code:
#include <stdio.h>
#include <stdlib.h>


int main()
{
    int N = rand() % ((2000-0+1)+0) - 1000;
    int X;
    int turn = 0;
    printf("Game start.\n");
    while(turn < 11)
    {
        printf("Insert number: \n");
        scanf("%D", X);
        turn = turn + 1;
        if (X == N)
        {
            printf("Correct, the number was %d.\n press Enter, to exit.", N);
            scanf("");
            exit(0);
        }
        else
        if (X < N)
        {
            printf("Bollocks, too small.");
        }
        else
        if (X > N)
        {
            printf("Nice try, but too big.");
        }
        else
        {
            printf("You lost. The number was %d.\n Press Enter, to exit.", N);
         };
    };
}